Skip to content

Order brush selection by sweep direction#14

Open
theop-luma wants to merge 1 commit intoluma/v4.4.xfrom
theop/brush-selection-order
Open

Order brush selection by sweep direction#14
theop-luma wants to merge 1 commit intoluma/v4.4.xfrom
theop/brush-selection-order

Conversation

@theop-luma
Copy link
Copy Markdown
Collaborator

Summary

  • During brush selection, selectedShapeIds are now ordered by when each shape first entered the brush rectangle
  • Dragging left-to-right gives left-to-right order, and vice versa
  • Accessible after brush completes via Brushing.selectionOrder map

Test plan

  • Create several shapes in a row
  • Brush select left-to-right, verify editor.getSelectedShapeIds() matches left-to-right order
  • Brush select right-to-left, verify reverse order
  • Shift+brush to add to existing selection, verify new shapes appended in sweep order
  • Shrink brush so shapes leave, then re-expand — verify re-entered shapes get fresh order

🤖 Generated with Claude Code

During brush selection, shapes are now ordered in selectedShapeIds
by the time they first entered the brush rectangle. This enables
consumers to determine sweep direction (e.g. left-to-right vs
right-to-left) from the selection order.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Mar 17, 2026

PR Summary

Medium Risk
Changes the ordering semantics of editor.setSelectedShapes during brush selection, which may affect downstream behaviors that depend on selection order (e.g. grouping/alignment operations). Logic is localized to Brushing but touches core interaction UX.

Overview
Brush selection now preserves a deterministic sweep/entry order for selectedShapeIds instead of using an unordered set.

Brushing tracks when each shape first enters the brush rectangle via a new selectionOrder map and applies that ordering when calling editor.setSelectedShapes, including shift+brush additive selection and cases with no hit-test candidates.

Written by Cursor Bugbot for commit b85d51a. This will update automatically on new commits. Configure here.

@theop-luma theop-luma requested a review from kaznaan March 17, 2026 18:04
Copy link
Copy Markdown
Collaborator

@kaznaan kaznaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants